<?php
/** $Id: default_form.php 11917 2009-05-29 19:37:05Z ian $ */
	defined( '_JEXEC' ) or die( 'Restricted access' );
	$session = JFactory::getSession();
	$app = JFactory::getApplication();
	$template = JURI::base() . 'templates/' . $app->getTemplate();
	$params    = &JComponentHelper::getParams('com_jobs');
	// Merchant Number
	$merchantnumber = (int) $params->get('merchantnumber',8010648);
?>
<div id="header">
  <div id="w-header">
    <div class="logo"><a href="index.php">Forside</a> </div>
    <!--.logo-->
     {module login menu}    
    <!--.nav-top-1-->
    <div class="clear"></div>
    <div class="main-nav">
      {module main menu}
    </div>
    <!--.main-nav-->
    <div class="clear"></div>
  </div>
  <!--#w-header--> 
</div>
<!--#header-->

<div id="main">
  <div id="w-main">
    <div id="main-left">
	<div class="left-find"></div>
	<div class="right-find"></div>
		<div class="find">
			{module search}
		</div> 
      <!--.find-->
      <div class="clear"></div>
      <div class="infomation">
		<?php $article = JUtility::getArticle(15); ?>
        <h2><a href="#"><?php echo $article->title; ?></a></h2>
        <?php echo $article->introtext; ?>
      </div>
      <!--.infomation--> 
    </div>
    <!--#main-left-->
  <div id="main-right2">
      <div id="buy-task-page">
       	<div class="buy-task-content">
       		<?php $article = JUtility::getArticle(19);	?>
			<?php echo $article->introtext;?>        
       		
		<form id="ePay" name="ePay" method="post" action="https://ssl.ditonlinebetalingssystem.dk/auth/default.aspx">
			<table cellspacing="0" cellpadding="3" style="width: 800px;">
			<tbody>

			<div>
				<label>Amount:</label>				
				<input type="text" style="width: 200px;" value="1" name="amount" id="amount">			
			</div>
			
			<div>
				<label>Card no:</label>
				<input type="text" style="width: 200px;" value="" name="cardno" id="cardno">
			</div>
			
			<div>
				<label>Exp. month:</label>
					<select name="expmonth" id="expmonth">
						<option value="01">01</option>
						<option value="02">02</option>
						<option value="03">03</option>
						<option value="04">04</option>
						<option value="05">05</option>
						<option value="06">06</option>
						<option value="07">07</option>
						<option value="08">08</option>
						<option value="09">09</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
					</select>
				
			</div>
			<div>
				<label>Exp. year:</label>
					<select name="expyear" id="expyear">
						<option value="09">09</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
						<option value="13">13</option>
						<option value="14">14</option>
						<option selected="" value="15">15</option>
						<option value="16">16</option>
						<option value="17">17</option>
						<option value="18">18</option>
						<option value="19">19</option>
						<option value="20">20</option>
					</select>
			</div>
			<div>
				<label>CVC:</label>
					<input type="text" value="" style="width: 200px;" name="cvc" id="cvc" maxlength="3">
			</div>
			
			</tbody></table>
			<input type="hidden" value="<?php echo $merchantnumber; ?>" name="merchantnumber">
			<input type="hidden" value="0" name="instantcapture">
			<input type="hidden" value="1" name="language">
			<input type="hidden" value="<?php echo JUri::base().'index.php?option=com_jobs&view=kobopgaver&layout=callback';  ?>" name="callbackurl">
			<!--<input type="hidden" value="https://relay.ditonlinebetalingssystem.dk/relay/v2/relay.cgi/<?php echo JUri::base().'index.php?option=com_jobs&view=kobopgaver&layout=fail';  ?>" name="declineurl">
            -->
            <input type="hidden" value="<?php echo JUri::base().'index.php?option=com_jobs&view=kobopgaver&layout=fail';  ?>" name="declineurl">
			<input type="hidden" value="<?php echo JUri::base().'index.php?option=com_jobs&view=kobopgaver&layout=accept';  ?>" name="accepturl">
			<input type="hidden" value="<?php echo time();?>"  name="orderid">
			<input type="hidden" value="208"  name="currency">
	
		</form>
            <div class="bnt-payment">
            	<a  onclick="processpayment()">Payment</a>
                <script type="text/javascript">
				jQuery(document).ready(function(jQuery) {
					processpayment=function(){		
						jQuery('#amount').val(jQuery('#amount').val()*100);
						jQuery('#ePay').submit();
						
					 };
				 });
			</script>
            </div><!--.bnt-payment-->
      	</div>
      <!--.buy-task-content--> 
      
      </div>
      <!--#buy-task-page--> 
    </div>
    <!--#main-right--> 
  </div>
  <!--#w-main--> 
</div>
<!--#main-->
<div class="clear"></div>
<div id="contact">
  <div id="w-contact">
    <div class="left-con">
      <div class="left-con-top"></div>
      <!--left-con-top-->
      <div class="left-con-mid">
        <div class="contact-con">
		<?php $article = JUtility::getArticle(17); ?>
          <h2><a href="#"><?php echo $article->title; ?></a></h2>
          <?php echo $article->introtext; ?>
        </div>
        <!--.contact-con-->
        <div class="contact-con contact-con2">
			<?php $article = JUtility::getArticle(18); ?>
			<h2><a href="#"><?php echo $article->title; ?></a></h2>
			<?php echo $article->introtext; ?>
        </div>
        <!--.contact-con--> 
      </div>
      <!--left-con-mid-->
      <div class="left-con-bottom"></div>
      <!--left-con-bottom--> 
    </div>
    <!--.left-con-->
    
    <div class="address">
		<?php $article = JUtility::getArticle(16); ?>
		<h2><?php echo $article->title; ?></h2>
		<?php echo $article->introtext; ?>
    </div>
    <!--address--> 
    
    <div class="contact-form">
		{module kontakt}
    </div><!--.contact-form-->
  </div>
  <!--w-contact--> 
</div>
<!--#contact-->
<div class="clear"></div>
<div id="copyright">
	<div id="w-copyright">
		{module footer}
	</div>
</div>
<!--#copyright-->
<?php                        	       
$input_amount = JText::_( 'Indtast din Antal' );
$input_cardno = JText::_( 'Indtast din Kortnummer' );
$input_expmonth = JText::_( 'Indtast din Udløbet måneder' );
$input_expyear = JText::_( 'Indtast din Udløbet år' );
$input_cvc = JText::_( 'Indtast din CVC' );
?> 
<script type="text/javascript">                   
jQuery(document).ready(function(jQuery) {
	jQuery.validator.addMethod('cvccode', function (value) { 
		if(value=='') return true;	
		return /^\d{3}$/.test(value); 
	   }, '');
		
		
		jQuery("#ePay").validate(
			{
				errorPlacement: function(error, element) {			
			},
			invalidHandler: function(form, validator) {
			  var errors = validator.numberOfInvalids();
			if (errors) {
                //$('#alert').html(validator['errorList'][0]['message']);
				jQuery('#alert').html(validator['errorList'][0]['message']);
    			jQuery('#backoverlay').show();
    			jQuery('#show_popup').show();
            	jQuery('#f_focus').html(validator['errorList'][0]['element'].name);
				validator['errorList'][0]['element'].focus();
				
			  } else {
			  }
			},
			rules: {
				amount:{
					required: true,
					digits: true,
					min: 1,
				},			
				cardno: {
					required: true,
					digits:true,
				},
				expmonth:{
					required: true,
				},
				expmonth:{
					required: true,
				},
				cvc:{
					required: true,
					cvccode: true,
				},
				
			},
			messages: {
				amount: "<?php echo $input_amount; ?>",
				cardno: "<?php echo $input_cardno; ?>",
				expmonth: "<?php echo $input_expmonth; ?>",
				expyear: "<?php echo $input_expyear; ?>",
				cvc: "<?php echo $input_cvc; ?>",
			}
		});
	});
</script>